<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>报价单</title>
    <%@ include file="/WEB-INF/views/include/head.jsp"%>
    <link rel="stylesheet" href="${ctxStatic}/css/list.css">
    <script>
   //检索 
   function searchListForm() {
    	var params = $("#searchForm").serialize();
    	$.post("${ctx}/purchase/contract/searchList?contractFlag=0",params, function(result) {
			var listHtml = result["purchaseContract"];
			var pageHtml = result["page"];
			$("#listHtml").html(listHtml);
			$("#paging").html(pageHtml);
			
		}, 'json');
	} 
        
 //重置
   function clean(){
       $("input").val("");
       $('#ognizationCategoryCd').val('');
       $("#ognizationCategoryCd").select2(); 
       searchListForm();
   }
 
    function selectStyle() {
    	//获取 iframe 数量 
    	var frLength = window.parent.frames.length;
    	//父画面下标 
    	var parentIndex = frLength-2;
    	var contractMaterialID = $("#listHtml tr.trSelected").find(".id").val();
    	var ognizationNameB = $("#listHtml tr.trSelected").find(".ognizationNameB").val();
    	var contractMaterialNO = $("#listHtml tr.trSelected").find(".contractMaterialNO").val();;
    	var contractMaterialQuantity = $("#listHtml tr.trSelected").find(".contractMaterialQuantity").val();
    	var contractAmount = $("#listHtml tr.trSelected").find(".contractAmount").val();
    	var bankName = $("#listHtml tr.trSelected").find(".bankName").val();
    	var bankAccountNo = $("#listHtml tr.trSelected").find(".bankAccountNo").val();
    			window.parent.frames[parentIndex].document.getElementById("contractMaterialID").value=contractMaterialID;
        		window.parent.frames[parentIndex].document.getElementById("ognizationName").value=ognizationNameB;
        		window.parent.frames[parentIndex].document.getElementById("contractMaterialNO").value=contractMaterialNO;
        		window.parent.frames[parentIndex].document.getElementById("contractMaterialQuantity").value=contractMaterialQuantity;
        		window.parent.frames[parentIndex].document.getElementById("contractAmount").value=contractAmount;
        		window.parent.frames[parentIndex].document.getElementById("bankName").value=bankName;
        		window.parent.frames[parentIndex].document.getElementById("bankAccountNo").value=bankAccountNo;
        		window.parent.frames[parentIndex].findMaterial(contractMaterialID);
    			closeWin();
	}
    //选择按钮事件
    function selectFunction(obj){
    	$("#listHtml tr").removeClass('trSelected');
    	$(obj).addClass('trSelected');
    	
    }
    </script>
    <style type="text/css">
    /* 采购合同号  */
    .another .table-cghth{width: 110px}
    /* 供货商(乙方) */
    .another .table-cgghs{width: 120px}
    /* 种类  */
    .another .table-cgzl{width: 60px}
    /* 订料数量  */
    .another .table-cgdlsl{width: 90px}
    /* 订料金额  */
    .another .table-cgdlje{width: 90px}
    /* 签订日期  */
    .another .table-cgqdrq{width: 80px}
    /* 结算日期  */
    .another .table-cgjsrq{width: 80px}
    /* 预订到料日期  */
    .another .table-cgyddl{width: 80px}
    /* 实际到料日期  */
    .another .table-cgsjdl{width: 80px}
    /* 创建人员  */
    .another .table-cgcjr{width: 80px}
    /* 创建时间  */
    .another .table-cgcjrq{width: 80px}
		                        
    </style>
</head>
<body style="min-width: 870px">
<form id="searchForm">
<div class="layerHeader clearfix" style="width: 990px">
	<p class="headerTitle"><spring:message code="purchaseAdvance_select_selectContract" /></p>
	<div class="headerButton clearfix">
                <button type="button" onclick="searchListForm();"><spring:message code="purchaseAdvance_select_search" /></button>
                <button type="button" onclick="clean();"><spring:message code="common_reset" /></button>
                <button type="button" onclick="selectStyle();"><spring:message code="purchaseAdvance_select_selected" /></button>
                <button type="button" onclick="closeWin();"><spring:message code="purchaseAdvance_select_cancle" /></button>
                </div>
</div>
<div class="listArea" style="width: 990px">
<c:set value="<%=ResourcesUtil.getConfig(\"supplier_category\")%>" var="supplierCategory" />
	<div class="listBg">
        <div class="searchArea clearfix">
            <div id="showHtml" class=" clearfix">
                <div class="searchInp clearfix">
                    <p><spring:message code="purchaseAdvance_select_contractNumber" /></p>
                    <input class="w-styleNub" id="contractMaterialNO" name="contractMaterialNO" value="">
                </div>
                <div class="searchInp clearfix">
                    <p><spring:message code="purchaseAdvance_select_supplier" /></p>
                    <input class="w-customer" id="ognizationName" name="ognizationName" value="">
                </div>
                <div class="searchInp clearfix">
                    <p><spring:message code="purchaseAdvance_select_date" /></p>
                    <div class="timeBox">
							<input type="text" onblur="CheckDate(this);" 
								id="dateStart" name="dateStart" style="width: 110px">
							<p class="list">~</p>
							<input type="text" onblur="CheckDate(this);" id="dateEnd" name="dateEnd"
								style="width: 110px" >
                    </div>        
                </div>      
            </div>
                
        </div>
   
        <div class="tableArea tabBoxSm" >
            <div class="tableScroll tabSm" style="overflow: auto;height: 420px;width:959px">
                <table cellpadding="0" class="tableHead another" >
                    <thead>
                    <tr>
                        <th><p class="table-No"><spring:message code="common_no" /></p></th>
                        <th><p class="table-cghth"><spring:message code="purchaseAdvance_select_contractNo" /></p></th>
                        <th><p class="table-cgdlsl">采购类别</p></th>
                        <th><p class="table-cgghs"><spring:message code="purchaseAdvance_select_supplierName" /></p></th>
                        <th><p class="table-cgzl"><spring:message code="purchaseAdvance_select_kinds" /></p></th>
                        <th><p class="table-cgdlsl"><spring:message code="purchaseAdvance_select_quantity" /></p></th>
                        <th><p class="table-cgdlje"><spring:message code="purchaseAdvance_select_amount" /></p></th>
                        <th><p class="table-cgqdrq"><spring:message code="purchaseAdvance_select_startDate" /></p></th>
                        <th><p class="table-cgjsrq"><spring:message code="purchaseAdvance_select_endDate" /></p></th>
                        <th><p class="table-cgcjr"><spring:message code="purchaseAdvance_select_creator" /></p></th>
                        <th><p class="table-cgcjrq"><spring:message code="purchaseAdvance_select_createDate" /></p></th>
                    </tr>
                    </thead>
                </table>
                <table cellpadding="0" class="tableBody another" >              
                    <tbody id = "listHtml">
                    
                    </tbody>
                </table>
            </div>
            
        </div>
    </div>
    <div id = "paging" ></div>
</div>
</form>
<script type="text/javascript">
$(document).ready(function(){
	// 下拉选框带搜索功能
    $("#ognizationCategoryCd").select2();
	searchListForm();
});
</script> 
</body>
</html>
	